<template>
    <div class="container">
        <div class="screen" ref="screen">
            <div class="top">
                <Top></Top>
            </div>
            <div class="bottom">
                <div class="left">
                    <Tourist class="tourist"></Tourist>
                    <Sex class="sex"></Sex>
                    <Age class="age"></Age>
                </div>
                <div class="center">
                    <Map class="map"></Map>
                    <Line class="line"></Line>
                </div>
                <div class="right">
                    <Rank class="rank"></Rank>
                    <Year class="year"></Year>
                    <Couter class="couter"></Couter>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang='ts'>
import { ref, onMounted } from 'vue'
import Top from './component/top/Top.vue'
import Tourist from './component/tourist/Toutist.vue'
import Sex from './component/sex/Sex.vue'
import Age from './component/age/Age.vue'

import Map from './component/map/Map.vue'
import Line from './component/line/Line.vue'

import Rank from './component/rank/Rank.vue'
import Couter from './component/couter/Couter.vue'
import Year from './component/year/Year.vue'

const screen = ref()

onMounted(() => {
    screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`
})

window.onresize = () => {
    screen.value.style.transform = `scale(${getScale()}) translate(-50%,-50%)`
}
function getScale(w = 1920, h = 1080) {
    const ww = window.innerWidth / w
    const wh = window.innerHeight / h
    return ww < wh ? ww : wh
}
</script>

<style scoped lang="scss">
.container {
    width: 100vw;
    height: 100vh;
    background: url(@/assets/screen/bg.png) no-repeat;
    background-size: cover;

    .screen {
        width: 1920px;
        height: 1080px;
        position: fixed;
        left: 50%;
        top: 50%;
        transform-origin: left top;
    }

    .top {
        width: 100%;
        height: 40px;
    }

    .bottom {
        display: flex;

        .right {
            flex: 1;
            display: flex;
            flex-direction: column;
            padding-left: 40px;

            .rank{
                flex:1.5; 
            }
            .year{
                flex: 1;
            }
            .couter{
                flex: 1;
            }
        }

        .left {
            flex: 1;
            height: 1040px;
            display: flex;
            flex-direction: column;

            .tourist {
                flex: 1.2;

            }

            .age {
                flex: 1;
            }

            .sex {
                flex: 1;
            }
        }

        .center {
            flex: 2;
            display: flex;
            flex-direction: column;

            .map {
                flex: 4;
            }

            .line {
                flex: 1.5;
            }
        }
    }
}
</style>